// pages/records/index.js
import {openDoc} from '../../utils/util'
import {goifOpen} from '../../utils/util'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    storageArr:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const vm = this;
    wx.getStorageInfo({success:(res)=>{
      res.keys.splice(res.keys.indexOf('userInfo'),1);
      const storageArr = [];
      res.keys.forEach((element,key) => {
        wx.getStorage({
          key: element,
          success: function(re){
              let obj = {key:element};
              obj.value = re.data;
              storageArr.push(obj)
              if((key+1)==res.keys.length){
                console.log(storageArr)
                vm.setData({
                  storageArr:storageArr
                })
              }

          }
        })
      });
    }})
  },
  godetails(e){
    var data = e.currentTarget.dataset.da;
    data.url = data.path;
    console.log(data);
    
    // console.log(data)
    // return;
    //type   0视频  1  文档   2  目录
    goifOpen(data)
  }
})